package peppa.george.org.Service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import peppa.george.base.Util.PageUtil;
import peppa.george.base.query.BaseQuery;
import peppa.george.org.Service.PicUserService;
import peppa.george.org.domain.PicUser;
import peppa.george.org.mapper.PicUserMapper;

import java.util.List;

@Service
public class PicUserServiceImpl  implements PicUserService{
    @Autowired
    private PicUserMapper picUserMapper;

    @Override
    public List<PicUser> findall() {
        System.out.println("service");
        return picUserMapper.findall();
    }

    @Override
    public void save(PicUser t) {
        picUserMapper.save(t);
    }

    @Override
    public PageUtil<PicUser> QueryData(BaseQuery query) {
        Integer count = picUserMapper.count(query);
        List<PicUser> picUsers = picUserMapper.pageQuery(query);
        PageUtil<PicUser> picUserPageUtil = new PageUtil<>();
        picUserPageUtil.setRows(picUsers);
        picUserPageUtil.setCount(count);
        return picUserPageUtil;
    }

    @Override
    public void remove(Long id) {
        picUserMapper.remove(id);
    }

    @Override
    public void update(PicUser t) {
        picUserMapper.update(t);
    }

}
